/****** Object:  Table [dbo].[form_controls]    Script Date: 08/30/2008 22:35:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[form_controls](
	[FormControlID] [uniqueidentifier] NOT NULL CONSTRAINT [DF_formcontrols_FormControlID]  DEFAULT (newid()),
	[ControlType] [int] NOT NULL,
	[Control] [nvarchar](max) NOT NULL,
	[ControlName] [nvarchar](max) NOT NULL,
	[RequiresRows] [bit] NOT NULL,
	[RequiresColumns] [bit] NOT NULL,
 CONSTRAINT [PK_formcontrols] PRIMARY KEY CLUSTERED 
(
	[FormControlID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[form_answerrowcolumn]    Script Date: 08/30/2008 22:35:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[form_answerrowcolumn](
	[FormResponseID] [uniqueidentifier] NOT NULL,
	[FormQuestionID] [uniqueidentifier] NOT NULL,
	[FormAnswerID] [uniqueidentifier] NOT NULL,
	[FormRowID] [uniqueidentifier] NOT NULL,
	[FormColumnID] [uniqueidentifier] NULL,
	[IsSelected] [bit] NOT NULL,
 CONSTRAINT [PK_formrowcolumnanswer] PRIMARY KEY CLUSTERED 
(
	[FormAnswerID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[form_answer]    Script Date: 08/30/2008 22:35:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[form_answer](
	[FormResponseID] [uniqueidentifier] NOT NULL,
	[FormQuestionID] [uniqueidentifier] NOT NULL,
	[FormAnswerID] [uniqueidentifier] NOT NULL,
	[Answer] [nvarchar](max) NOT NULL,
 CONSTRAINT [PK_formanswer] PRIMARY KEY CLUSTERED 
(
	[FormAnswerID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[form_response]    Script Date: 08/30/2008 22:35:47 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[form_response](
	[FormID] [uniqueidentifier] NOT NULL,
	[FormResponseID] [uniqueidentifier] NOT NULL,
	[TakenBy] [nvarchar](max) NULL,
	[TakenDate] [datetime] NOT NULL,
	[Reviewed] [bit] NULL,
	[ReviewedBy] [uniqueidentifier] NULL,
	[ReviewerComments] [nvarchar](max) NULL,
	[ReviewedDate] [datetime] NULL,
 CONSTRAINT [PK_formresponse] PRIMARY KEY CLUSTERED 
(
	[FormResponseID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[form_question]    Script Date: 08/30/2008 22:35:39 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[form_question](
	[FormID] [uniqueidentifier] NOT NULL,
	[FormQuestionID] [uniqueidentifier] NOT NULL,
	[Question] [nvarchar](max) NOT NULL,
	[FormControlID] [uniqueidentifier] NOT NULL,
	[FormControlWidth] [int] NULL,
	[FormControlHeight] [int] NULL,
	[FormControlRows] [int] NULL,
	[FormControlCols] [int] NULL,
	[FormControlLayout] [int] NULL,
	[FormPage] [int] NOT NULL,
	[IsRequired] [bit] NULL,
	[RequiredText] [nvarchar](max) NULL,
	[IsRegularExpressionValidatorRequired] [bit] NULL,
	[RegularExpression] [nvarchar](max) NULL,
	[RegularExpressionValidatorText] [nvarchar](max) NULL,
	[IsCompareValidatorRequired] [bit] NULL,
	[CompareValidatorType] [int] NULL,
	[CompareValidatorText] [nvarchar](max) NULL,
	[IsRangeValidatorRequired] [bit] NULL,
	[RangeValidatorText] [nvarchar](max) NULL,
	[RangeStart] [nvarchar](max) NULL,
	[RangeEnd] [nvarchar](max) NULL,
	[CreateDate] [datetime] NOT NULL,	
	[SortOrder] [int] NOT NULL,
	[IsOtherOption] [bit] NULL,
	[OtherOptionText] [nvarchar](max) NULL,		
 CONSTRAINT [PK_FormQuestion] PRIMARY KEY CLUSTERED 
(
	[FormQuestionID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[form]    Script Date: 08/30/2008 22:35:19 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[form](
	[FormID] [uniqueidentifier] NOT NULL,
	[FormName] [nvarchar](max) NOT NULL,
	[AllowMultipleResponses] [bit] NOT NULL,
	[CurrentUserID] [uniqueidentifier] NULL,
	[IV_FormType] [int] NOT NULL,
	[ExpireDate] [datetime] NULL,
	[UserID] [uniqueidentifier] NOT NULL,
	[FormCompleteMessage] [nvarchar](max) NULL,
	[CreateDate] [datetime] NOT NULL,
	[ModifiedUserID] [uniqueidentifier] NULL,
	[ModifiedDate] [datetime] NULL,
	[RegisteredUserOnly] [bit] NULL,
 CONSTRAINT [PK_form] PRIMARY KEY CLUSTERED 
(
	[FormID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[form_questionrows]    Script Date: 08/30/2008 22:35:43 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[form_questionrows](
	[FormQuestionID] [uniqueidentifier] NOT NULL,
	[FormRowID] [uniqueidentifier] NOT NULL,
	[RowChoice] [nvarchar](max) NOT NULL,
	[CreateDate] [datetime] NOT NULL,	
	[IsOtherOption] [bit] NOT NULL,		
	[SortOrder] [int] NOT NULL,	
 CONSTRAINT [PK_formquestionrows] PRIMARY KEY CLUSTERED 
(
	[FormRowID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[form_questioncolumns]    Script Date: 08/30/2008 22:35:41 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[form_questioncolumns](
	[FormQuestionID] [uniqueidentifier] NOT NULL,
	[FormColumnID] [uniqueidentifier] NOT NULL,
	[ColumnChoice] [nvarchar](max) NOT NULL,
	[CreateDate] [datetime] NOT NULL,	
	[SortOrder] [int] NOT NULL,	
 CONSTRAINT [PK_formquestioncolumns] PRIMARY KEY CLUSTERED 
(
	[FormColumnID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
